<extend name="Layout/ins_page" />
<block name="content">
	<style>
		.sub-sidebar li.active {
			background: #f2f2f2;
		}
		.content-wrap * {
			line-height: 28px;
		}
		@media screen and (max-width: 768px) {
			.tt .layui-form-label {
				width: 100%;
				text-align: left;
			}
			.tt .layui-input-block {
				width: 100%;
				text-align: left;
				margin-left: 0px;
			}
		}
	</style>
	{:W('PageHeader/adv_search',array('name'=>'审核','search'=>'M'))}
	<div class="x-panel hidden" id="adv_search">
		<form method="post" name="form_adv_search" id="form_adv_search">
			<div class="x-panel-header">
				<h4>高级搜索</h4>
				<div class="split"></div>
				<a  class="btn" id="submit_adv_search">搜索</a>
				<a  class="btn btn-cancel" id="close_adv_search">关闭</a>
			</div>
			<div class="x-panel-header-body frame">
				<div class="bit-2">
					<div class="layui-form-item">
						<label class="layui-form-label" for="eq_dept_id">部门：</label>
						<div class="layui-input-block">
							<select class="layui-input" name="eq_dept_id">
								<option value="">选择部门</option>
								{$dept_list}
							</select>
						</div>
					</div>
				</div>
				<div class="bit-2">
					<div class="layui-form-item">
						<label class="layui-form-label" for="eq_user_id">登录人：</label>
						<div class="layui-input-block">
							<select class="layui-input" name="eq_user_id">
								<option value="">选择人员</option>
								{:fill_option($emp_list)};
							</select>
						</div>
					</div>
				</div>
				<div class="bit-2">
					<div class="layui-form-item">
						<label class="layui-form-label" for="eq_status">状态：</label>
						<div class="layui-input-block">
							<select class="layui-input" name="eq_status">
								<option value="">选择状态</option>
								<option value="通过">通过</option>
								<option value="不通过">不通过</option>
							</select>
						</div>
					</div>
				</div>
				<div class="bit-2">
					<div class="layui-form-item">
						<label class="layui-form-label" for="content">内容：</label>
						<div class="layui-input-block">
							<input class="layui-input" type="text" id="li_content" name="li_content">
						</div>
					</div>
				</div>
				<div class="bit-2">
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">登录时间：</label>
							<div class="layui-input-inline" style="width: 100px;">
								<input type="text" class="layui-input input-start-date" name="be_create_time" readonly="readonly" />
							</div>
							<div class="layui-form-mid">
								-
							</div>
							<div class="layui-input-inline" style="width: 100px;">
								<input type="text" class="layui-input input-end-date" name="en_create_time" readonly="readonly" />
							</div>
						</div>
					</div>
				</div>
			</div>
		</form>
	</div>
	<div class="sub-frame">
		<div class="sub-sidebar ul-table">
			<ul>
				<li class="thead">
					<span class="col-6 grow-1">姓名</span>
					<span class="col-6 grow-1">部门</span>
					<span class="col-6 grow-1">状态</span>
					<span class="col-15 grow-1">日期</span>
				</li>
				<volist name="list" id="vo">
					<li data="{$vo.id}">
						<span class="col-6 grow-1">{$vo.user_name}</span>
						<span class="col-6 grow-1">{$vo.dept_name}</span>
						<span class="col-6 grow-1">
							<empty name="vo.status">
								待审核
								<else />
								{$vo.status}
							</empty> </span>
						<span class="col-15 grow-1">{$vo.start_date}~{$vo.end_date}</span>
						<!--<span class="col-10"><empty name="vo.status">
						<a href="{:U('set_audit','id='.$vo['id'])}&status=1">通过</a>&nbsp;| <a href="{:U('set_audit','id='.$vo['id'])}&status=0">不通过</a>
						</empty></span>-->
					</li>
				</volist>
			</ul>
		</div>
		<div class="sub-content sub-content ">
			<div class="frame" >
				<input type="hidden" id="work_log_id">
				<div class="bit-1" style="background:#f5f5f5;padding-top:15px;border:1px solid #ddd;">
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">起止日期：</label>
							<div class="layui-input-inline"  style="width:100px">
								<input type="text" class="layui-input " id="start_date" name="start_date" readonly="readonly">
							</div>
							<div class="layui-form-mid">
								-
							</div>
							<div class="layui-input-inline" style="width:100px">
								<input type="text" class="layui-input " id="end_date" name="end_date" readonly="readonly">
							</div>
						</div>
					</div>
					<div class="layui-form-item tt">
						<label class="layui-form-label">工作内容：</label>
						<div class="layui-input-block">
							<div class="content-wrap" id="content" style="height:200px;overflow-y: auto;"></div>

						</div>
					</div>
					<div class="layui-form-item tt" >
						<label class="layui-form-label">工作计划：</label>
						<div class="layui-input-block">
							<div class="content-wrap" id="plan" style="height:200px;overflow-y: auto;"></div>

						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">附件：</label>
						<div class="layui-input-block" id="add_file">
							<ul class="file_list" id="file_list"></ul>
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label"></label>
						<div class="layui-input-block">
							<a class="btn btn_audit" data="1">通过</a>
							<a class="btn btn_audit" data="0">不通过</a>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</block>
<block name="js">
	<script type="text/javascript">
		layui.use(['global'], function() {
			var $ = layui.jquery;
			set_return_url(null);

			$(".btn_audit").click(function() {
				location.href = "{:U('set_audit')}&id=" + $("#work_log_id").val() + "&status=" + $(this).attr('data');
			});
			$(".sub-sidebar li").on("click", function() {
				$(".sub-sidebar li").removeClass('active');
				$(this).addClass("active");

				$id = $(this).attr("data");
				send_ajax("{:U('get_work_log')}", "id=" + $id, function(ret) {
					$("#work_log_title").html(ret.user_name + to_date(ret.create_time));
					$("#start_date").val(ret.start_date);
					$("#end_date").val(ret.end_date);
					$("#content").html(ret.content);
					$("#plan").html(ret.plan);
					$("#work_log_id").val(ret.id);
					$("#add_file").html(ret.html);
				});
			});

			function to_date(date) {
				return new Date(parseInt(date) * 1000).toLocaleString().replace(/:\d{1,2}$/, '');
			};

			$("select[name='eq_dept_id']").change(function() {
				$("select[name='eq_user_id']").html("");
				send_ajax("{:U('get_user_list')}", "dept_id=" + $(this).val(), function(data) {
					for (var v in data) {
						$("select[name='eq_user_id']").append("<option value='" + v + "'>" + data[v] + "</option>");
					}
				});
			});
		});

		function add() {
			window.open("{:U('add')}&type={$type}", "_self");
		}

	</script>
</block>